#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/5/14 9:25
# @Author : 吴敬超
# explain:

import pandas as pd
import threading
import numpy as np
import netCDF4 as nc
import datetime
import csv
import time as ti
import glob
import multiprocessing
import sys
file_path = 'D:/ehlocean/data/TEMPSALT/B.E.13.B1850C5.ne120_t12.sehires38.003.sunway_02.rtm.h0.0022-02.nc'

ncdt = nc.Dataset(file_path)
#
# print  ncdt.variables["QCHANR"].ncattrs()
# print  ncdt.variables["QCHANR"].getncattr("units")
# print  ncdt.variables["QCHANR"].get_dims()

for dim in ncdt.variables["QCHANR"].get_dims():
    print dim

    print dim.name


# ncdt.variables.items()
# for name, variable in ncdt.variables.items():
#     for attrname in variable.ncattrs():
#         print("{} -- {}".format(attrname, variable.getncattr(attrname)))
#
# with nc.MFDataset(nc) as src:
#     for name, variable in src.variables.items():
#         for attrname in variable.ncattrs():
#            print("{} -- {}".format(attrname, variable.getncattr(attrname)))
# #
# for var in nc.variables.values():
#     print var
#     print var.dtype

# print  nc.variables["QCHANR"]

#
# for var in nc.variables.keys():
#     print(var,":")
#     for att in nc.variables[var].ncattrs():
#         print(att,"==",getattr(nc.variables[var], att))
#     print("Shape:",nc.variables[var].shape)
# #
